package com.hqyj.javaSpringCloudAccount.dao;

import com.hqyj.entity.account.RoleResource;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

/**
 * @author ：Cwd
 * @Description：RoleResourceDao
 * @date ：2021/8/26 11:25
 */
@Mapper
@Repository
public interface RoleResourceDao {

    @Insert("insert into account_role_resource (role_id, resource_id) values (#{roleId}, #{resourceId})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void insertRoleResource(RoleResource roleResource);

    @Delete("delete from account_role_resource where resource_id = #{resourceId}")
    void deleteRoleResourceByResourceId(int resourceId);

    @Delete("delete from account_role_resource where role_id = #{roleId}")
    void deleteRoleResourceByRoleId(int roleId);
}
